<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link href="${resources}/plugins/fontAwesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="${resources}/plugins/swiper/3.3.1/swiper.min.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/PersonalCenter_new.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/common.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/home.css" rel="stylesheet" type="text/css">
    <#include "setwxshare.ftl"/>
		<script >
		var path="${path}";
		var resources="${resources}";
	</script>
</head>
<body>
<img class="imgBg" style="display:none;" src="${resources}/images/5_2.png">
<div id="container">
   
      <!--搜索栏-->
    <div class="header">
      <form class="search"  action="${path}/commodity/indexSearch" method="post"  id="searchForm">
        <input type="search" id="search" name="searchCondition" placeholder="请输入商品名称">
      </form>
        <img src="${resources}/images/home/1_1.png" class="logo">
        <span class="fa fa-search" onclick="commoditysearch()"></span>
    </div>
     
    <div id="wrapper">
    <div>
    
      
        <!--轮播图-->
        <div class="swiper-container">
            <div class="swiper-wrapper">
            	<#list adList as ad>
            	<div class="swiper-slide"><a href="${ad.linkurl}"><img src="${ad.picurl}"></a></div>
            	</#list>
            </div>
            <div class="swiper-pagination"></div>
        </div>


      <!--导航栏-->
    <ul class="nav">
   <!--  <#list marketList as market>
        <li>
            <a href="${path}/${market.linkurl}">
                <img src="${market.picurl}">
                <span>${market.name}</span>
            </a>
        </li>  
    </#list>  -->
            <li>
                <a href="${path}/vouchermarket/index">
                    <img src="${resources}/images/10_1.png" alt="">
                </a>
            </li>
            <li>
                <a href="${path}/commodity/index/3">
                    <img src="${resources}/images/10_2.png" alt="">
                </a>
            </li>
         	<li>
                <a href="${path}/score/market/index">
                    <img src="${resources}/images/10_3.png" alt="">
                </a>
            </li>
             <li>
                <a href="${path}/index/second">
                    <img src="${resources}/images/10_10.png" alt="">
                </a>
            </li>

    </ul>

    <!--特色活动-->
    <div class="line">
        <img src="${resources}/images/home/1_3.png">
    </div>
      
    <ul class="activityList">
     <#list floorList as floor1>   
        <#list floor1.floorItemList as floor>
          <li><a href="${path}${floor.linkurl}"><img src="${floor.picurl}"></a></li>
        </#list>
     </#list>
    </ul> 

        <!--精选好货-->
    <div class="line">
        <img src="${resources}/images/home/1_4.png">
    </div>

          
   <ul class="goodsList">
    
    </ul>
		<div id="tip">正在加载中..</div>
   </div>

  </div>
 
</div> 
   
    <ul class="homeButton">
        <li>
            <a href="javascript:void (0)" onclick="index()" class="home">
                <img src="${resources}/images/1_9_33.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/article/index" class="bank">
                <img src="${resources}/images/1_10_24.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/bbs" class="local">
                <img src="${resources}/images/1_10_26.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/manage/commodityCart/cartShow?marketId=3" class="local">
                <img src="${resources}/images/1_10_28.png" alt="">
            </a>
        </li>
        <li>
            <a href="${path}/manage/member" class="personalCenter">
                <img src="${resources}/images/1_10_30.png" alt="">
            </a>
        </li>
    </ul>
</div>

<script src="${resources}/plugins/jquery/2.2.2/jquery.min.js"></script>
<script src="${resources}/plugins/swiper/3.3.1/swiper.jquery.min.js"></script>
<script src="${resources}/js/iscroll-probe.js"></script>
<script src="${resources}/js/index.js"></script>
<script>
     /*配置轮播图*/
    var mySwiper = new Swiper('.swiper-container', {
        loop: true,
        pagination: '.swiper-pagination',
        autoplay: 2840,
        autoplayDisableOnInteraction: false
    })

    //主页面查询
	function commoditysearch(){
			$("#searchForm").submit();
	}
  	function index(){
  		windon.location.href="${path}/index";
  	}
	
	$(function(){
		getCheapGoodsList();
	})
	function getCheapGoodsList(){
		
		$.ajax({
        		type:"post",
        		async:true, 
	        	url:"${path}/index/more",
	        	data:{
	        		index:"-1",
	        		offset:"10"
	        	},
        		success:function(resultjson){	
        			if('000' == resultjson.code){
        				var html = "";
        				for (var i = 0; i < resultjson.result.length; i++) {
        					var goods=resultjson.result[i];
        					html+= '<li data-id="'+goods.id+'">';
        					html+= '<a href="${path}/commodity/info?goodsId='+goods.id+'">';
        					html+= ' <div class="imgCon">';
        					html+= ' <img class="imgBg" src="${resources}/images/5_2.png">';
        					html+= ' <img class="goodsImg" src="'+goods.picurl+'">';
        					html+= '</div>';
        					html+= ' <div class="goodsName">'+goods.name+'</div>';
        					html+= '<div class="price">';
        					html+= ' <span>￥'+goods.price+'元</span>';
        					html+= ' <span class="priceOld">￥'+goods.originalPrice+'</span>';
        					html+= '</div>';
        					html+= '  </a>';
        					html+= '  </li>';
        				}	
        				$(".goodsList").append(html);
        				if(resultjson.result.length>=10){
 	  		            	$("#loading").hide();
 			  	            $("#tip").show();
 	  		            }else{
 	  		            	$("#loading").hide();
 	  		            	$("#tip").hide();
 	  		            }
			            myScroll.refresh();
			            main.max = myScroll.maxScrollY;
        			}
        		}
        	})
	}

	
  
    
</script>
</body>
</html>